/*************************************************************************
 *                                                                       *
 * This file is part of the FreeMAPs distribution.  For full copyright   *
 * information, see COPYRIGHT and COPYING.LESSER.                        *
 *                                                                       *
 * Author:           sqbang                                              *
 * Email:            sqbang@ustc.edu                                     *
 * Date:             2011.10.11                                          *
 *                                                                       *
 *************************************************************************/

#ifndef FreeMAPs_include_COMMON_bdry_RobinBoundaryCondition_h
#define FreeMAPs_include_COMMON_bdry_RobinBoundaryCondition_h

#include "FreeMAPsConfig.h"

//COMMON headers
#include "COMMON/bdry/IrregularBoundaryConditionStrategy.h"

namespace FreeMAPs
{

//forward declaration
#ifdef FREEMAPS_HAVE_SAMRAI
class AttributeOfCell;
#endif
class Function;

/**
 * the boundary condition has the form of
 *   \f[ \mathbf{k}(\mathbf{\nabla f}\cdot\mathbf{N}) + hf = h_bf_b \f]
 * or in component format:
 *   \f[ k_0N_x\frac{df}{dx} + k_1N_y\frac{df}{dy} + k_2N_z\frac{df}{dz} + hf = h_bf_b \f]
 *
 * where \f$ \mathbf{k}=(k_0, k_1, k_2)\f$ is the coefficient of first order item.
 * \f$ \mathbf{N} = (N_x, N_y, N_z)\f$ is the out-normal direction of the boundary
 * \f$ \nabla f = grad (f) = (\frac{df}{dx}, \frac{df}{dy}, \frac{df}{dz})\f$ is the gradient of the field
 * \f$ h \f$ is the coefficient of zero order item.
 * \f$ h_b \f$ is the coefficient on the boundary and \f$ f_b \f$ is
 * the value on boundary defined by user.
 */
class RobinBoundaryCondition : public IrregularBoundaryConditionStrategy
{
public:

    RobinBoundaryCondition (
        const std::string& parent_name,
        const std::string& bc_name,
        const PDEEquationEnsembleStrategy* equation_ensemble);

    virtual
    ~RobinBoundaryCondition();
#if 0
    //para_h
    virtual void
    set_para_h(
            gFreeMAPs::ParaFluxBean* para_h);

    virtual gFreeMAPs::ParaFluxBean*
    get_para_h();

    //para_fb
    virtual void
    set_para_fb(
            gFreeMAPs::ParaFluxBean* para_fb);

    virtual gFreeMAPs::ParaFluxBean*
    get_para_fb();
#endif
public:

    /**
     * @return the boundary condition type
     */
    inline BoundaryConditionType
    get_type() const;

    inline bool
    require_set_variable() const;


private:

    void
    clear();

    void
    get_info_for_derived_object_from_input (
        const InputDatabase* db);

    std::string
    get_info_from_derived_object() const;

private:

    typedef IrregularBoundaryConditionStrategy Parent;

    //Function* d_para_h;
    //gFreeMAPs::ParaFluxBean* d_para_h;//para_h //connection coefficient

    //Function* d_para_fb;
   // gFreeMAPs::ParaFluxBean* d_para_fb;//para_fb //free stream temperature

private:

    DISALLOW_COPY_AND_ASSIGN (RobinBoundaryCondition);
};

} // namespace FreeMAPs

#include "COMMON/bdry/RobinBoundaryCondition.inl"

#endif
